package arbre.utils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class Chemin implements Serializable{

	public static String DEFAULT = "defaut";
	String id;
	List<Segment> segments;
	String type = DEFAULT;
	
	List<String> intersections = new ArrayList<String>();
	List<String> polygones = new ArrayList<String>();

	public Chemin()
	{
		
	}
	public Chemin(String id, String type)
	{
		this.type = type;
	}

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public List<Segment> getSegments() {
		return segments;
	}
	public void setSegments(List<Segment> segments) {
		this.segments = segments;
	}

	public String toString(){
		StringBuffer sb = new StringBuffer();
		//sb.append("<route id=\"").append(id).append("\"");
		//sb.append(" type=\""+ this.type +"\" ");
		//sb.append(" >");
		for(Segment segment : segments)
			sb.append(segment.toString()).append("\n");
		//sb.append("</route>");
		return sb.toString();
	}
	
	public String getType() {
		if(type != null)
			return type;
		else 
			return DEFAULT;
	}
	public void setType(String type) {
		this.type = type;
	}
	public List<String> getIntersections() {
		return intersections;
	}
	public void setIntersections(List<String> intersections) {
		this.intersections = intersections;
	}
	public void addIntersections(String intersection) {
		this.intersections.add(intersection);
	}

	public void setPolygones(List<String> polygones){
	this.polygones = polygones;	
	}

	public void addPolygones(String id){
	this.polygones.add(id);		
	}
	
}
